package com.ibeeking.gmc.global.g.rest.controller.v1;

import com.ibeeking.gmc.global.g.rest.service.ICampaignSceneTenantService;
import com.ibeeking.gmc.global.service.common.param.CampaignSceneTenantParam;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @ClassName CampaignSceneController控制器
 * @Description 活动场景
 * @Author ibeeking
 * @Date 2020-12-01 18:15
 **/
@RestController
@RequestMapping("/b/campaignSceneTenant/v1")
public class CampaignSceneTenantController {

    @Resource
    private ICampaignSceneTenantService campaignSceneTenantServiceImpl;

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "租户配置活动场景")
    @PostMapping(value = "/configTenant")
    public Boolean configTenant(@RequestBody @Validated CampaignSceneTenantParam param) {
        return campaignSceneTenantServiceImpl.configTenant(param);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "租户配置活动场景")
    @GetMapping(value = "/scenesByTenantId/{tenantId}")
    public List<String> scenesByTenantId(@PathVariable @NotNull(message = "租户id不能为空") Integer tenantId) {
        return campaignSceneTenantServiceImpl.scenesByTenantId(tenantId);
    }
}
